package edu.ped.android.utils;

public class AbsoluteGesture extends GestureNFC{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public AbsoluteGesture(){
		super();
	}

	
	public int compare(GestureNFC list){
		if( this.trajectory.get(0).equals(list.trajectory.get(0)) && 
				this.trajectory.get(this.trajectory.size()-1).equals(list.getTrajectory().get(list.getTrajectory().size()-1))
				&& list instanceof AbsoluteGesture ){
			int u = 0;
			int saut = 0;
			for(int i = 0; i < list.getTrajectory().size(); i++){
				if(trajectory.get(u).equals(list.getTrajectory().get(i))){
					u++;
					saut = 0;
				}
				else{
					saut++;
					if(saut > SAUT)
						return COMPARE_TOO_LONG_JUMP;
				}
			}
			return COMPARE_SUCCESS;
		}
		return COMPARE_FAIL;		
	}
}
